import java.util.*;

/**
 * @Author 12629
 * @Description：
 */
class Student {
    //自定义类型 建议 最好直线比较这些接口
} 
public class Test {

    public static void main(String[] args) {
        Set<String> set = new TreeSet<>();
        set.add("hello");
        set.add("abcd");
        //set.add("abcd");
        set.add("world");

        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }
        //System.out.println(set);

        /*for(String s :set) {
            System.out.println(s);
        }*/
    }


    public static void main2(String[] args) {
        //根据Key值 来判断大小
        Map<String,Integer> map = new TreeMap<>();
        map.put("hello",3);
        map.put("abcd",13);
        map.put("world",9);
        //System.out.println(map);

        //这个是把map转换成了set
        Set<Map.Entry<String,Integer>> set = map.entrySet();

        for(Map.Entry<String,Integer> entry : set) {
            System.out.println("key: "+entry.getKey() +" val: "+entry.getValue());
        }

        //System.out.println(map.get("abcd"));
        //System.out.println(map.getOrDefault("abcd",0));

        /*Set<String> set = map.keySet();
        System.out.println(set);

        Collection<Integer> values = map.values();
        System.out.println(values);
*/

        /*Map<Student,Integer> map2 = new TreeMap<>();
        map2.put(new Student(),10);*/
    }
    public static void main1(String[] args) {
        int[] array = {4,2,1,6};
        BinarySearchTree binarySearchTree = new BinarySearchTree();
        for (int i = 0; i < array.length; i++) {
            binarySearchTree.insert(array[i]);
        }
        //System.out.println(binarySearchTree.search(14));
        binarySearchTree.remove(4);
        System.out.println("===");
    }
}
